﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model;
using System.Collections;

namespace FindSales
{
    class FindSalesTask
    {
        public IEnumerable<Order> FindAllSales(string region, DateTime startDate, DateTime endDate)
        {
            NorthwindEntities entities = new NorthwindEntities();

            IEnumerable<Order> sales =
                from o in entities.Orders
                where o.OrderDate >= startDate && o.OrderDate < endDate && o.ShipRegion == region
                select o;

            return sales;
        }

        static void Main(string[] args)
        {
            DateTime startDate = new DateTime(1996, 7, 1);
            DateTime endDate = new DateTime(1996, 12, 1);

            FindSalesTask obj = new FindSalesTask();
            IEnumerable<Order> sales = obj.FindAllSales("Lara", startDate, endDate);

            foreach (var item in sales)
            {
                Console.WriteLine(item.ShipRegion + " " + item.ShippedDate);
            }
        }
    }
}